home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Database How-To / Visual Basic 4 Database - How-to (The Waite Group)(1995).iso / select9.fr_ / select9.fr
Text File  |  1995-07-04  |  6KB  |  203 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "QBE SELECTer"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   1560
  7.    ClientTop       =   1575
  8.    ClientWidth     =   6030
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    Height          =   3600
  19.    Left            =   1500
  20.    LinkTopic       =   "Form1"
  21.    ScaleHeight     =   3195
  22.    ScaleWidth      =   6030
  23.    Top             =   1230
  24.    Width           =   6150
  25.    Begin VB.TextBox txtTitle 
  26.       Height          =   315
  27.       Left            =   1800
  28.       TabIndex        =   8
  29.       Top             =   780
  30.       Width           =   3495
  31.    End
  32.    Begin VB.TextBox txtAuthor 
  33.       Height          =   315
  34.       Left            =   1800
  35.       TabIndex        =   7
  36.       Top             =   1200
  37.       Width           =   3495
  38.    End
  39.    Begin VB.TextBox txtPublished 
  40.       Alignment       =   2  'Center
  41.       Height          =   315
  42.       Left            =   1800
  43.       TabIndex        =   6
  44.       Top             =   1620
  45.       Width           =   1095
  46.    End
  47.    Begin VB.TextBox txtPublisher 
  48.       Height          =   315
  49.       Left            =   1800
  50.       TabIndex        =   5
  51.       Top             =   360
  52.       Width           =   3495
  53.    End
  54.    Begin VB.CommandButton cmdMove 
  55.       Caption         =   ">|"
  56.       Height          =   435
  57.       Index           =   3
  58.       Left            =   2400
  59.       TabIndex        =   4
  60.       Top             =   2220
  61.       Width           =   555
  62.    End
  63.    Begin VB.CommandButton cmdMove 
  64.       Caption         =   ">"
  65.       Height          =   435
  66.       Index           =   2
  67.       Left            =   1860
  68.       TabIndex        =   3
  69.       Top             =   2220
  70.       Width           =   555
  71.    End
  72.    Begin VB.CommandButton cmdMove 
  73.       Caption         =   "<"
  74.       Height          =   435
  75.       Index           =   1
  76.       Left            =   1320
  77.       TabIndex        =   2
  78.       Top             =   2220
  79.       Width           =   555
  80.    End
  81.    Begin VB.CommandButton cmdMove 
  82.       Caption         =   "|<"
  83.       Height          =   435
  84.       Index           =   0
  85.       Left            =   780
  86.       TabIndex        =   1
  87.       Top             =   2220
  88.       Width           =   555
  89.    End
  90.    Begin VB.CommandButton cmdClose 
  91.       Cancel          =   -1  'True
  92.       Caption         =   "Close"
  93.       Default         =   -1  'True
  94.       Height          =   435
  95.       Left            =   4020
  96.       TabIndex        =   0
  97.       Top             =   2220
  98.       Width           =   1215
  99.    End
  100.    Begin VB.Label Label4 
  101.       AutoSize        =   -1  'True
  102.       BackColor       =   &H00C0C0C0&
  103.       Caption         =   "Title:"
  104.       Height          =   195
  105.       Left            =   660
  106.       TabIndex        =   12
  107.       Top             =   840
  108.       Width           =   450
  109.    End
  110.    Begin VB.Label Label3 
  111.       AutoSize        =   -1  'True
  112.       BackColor       =   &H00C0C0C0&
  113.       Caption         =   "Author:"
  114.       Height          =   195
  115.       Left            =   660
  116.       TabIndex        =   11
  117.       Top             =   1260
  118.       Width           =   630
  119.    End
  120.    Begin VB.Label Label2 
  121.       AutoSize        =   -1  'True
  122.       BackColor       =   &H00C0C0C0&
  123.       Caption         =   "Published:"
  124.       Height          =   195
  125.       Left            =   660
  126.       TabIndex        =   10
  127.       Top             =   1680
  128.       Width           =   900
  129.    End
  130.    Begin VB.Label Label1 
  131.       AutoSize        =   -1  'True
  132.       BackColor       =   &H00C0C0C0&
  133.       Caption         =   "Publisher:"
  134.       Height          =   195
  135.       Left            =   660
  136.       TabIndex        =   9
  137.       Top             =   420
  138.       Width           =   855
  139.    End
  140. End
  141. Attribute VB_Name = "Form1"
  142. Attribute VB_Creatable = False
  143. Attribute VB_Exposed = False
  144. Option Explicit
  145.  
  146. Private db As DATABASE
  147. Private rs As Recordset
  148.  
  149. Private Sub cmdClose_Click()
  150.     End
  151. End Sub
  152.  
  153. Private Sub cmdMove_Click(Index As Integer)
  154.     Const MOVE_FIRST = 0
  155.     Const MOVE_PREVIOUS = 1
  156.     Const MOVE_NEXT = 2
  157.     Const MOVE_LAST = 3
  158.     
  159.     Select Case Index
  160.         Case MOVE_FIRST
  161.             rs.MoveFirst
  162.         Case MOVE_LAST
  163.             rs.MoveLast
  164.         Case MOVE_PREVIOUS
  165.             rs.MovePrevious
  166.             If rs.BOF Then rs.MoveFirst
  167.         Case MOVE_NEXT
  168.             rs.MoveNext
  169.             If rs.EOF Then rs.MoveLast
  170.     End Select
  171.     DisplayRecord
  172.     
  173. End Sub
  174.  
  175. Private Sub Form_Load()
  176.     Dim pastedSQL As String
  177.     Dim dbName As String
  178.     
  179.    ' Get the database name and open the database.
  180.     dbName = BiblioPath()       ' BiblioPath is a function in READINI.BAS
  181.     Set db = DBEngine.Workspaces(0).OpenDatabase(dbName)
  182.     
  183.     pastedSQL = "SELECT DISTINCTROW Publishers.Name, Titles.Title, Authors.Author, Titles.[Year Published]"
  184.     pastedSQL = pastedSQL & " FROM Authors INNER JOIN ((Publishers INNER JOIN Titles ON Publishers.PubID = Titles.PubID) INNER JOIN [Title Author] ON Titles.ISBN = [Title Author].ISBN) ON Authors.Au_ID = [Title Author].Au_ID"
  185.     pastedSQL = pastedSQL & " WHERE ((Publishers.City = 'new york'))"
  186.     pastedSQL = pastedSQL & " ORDER BY Publishers.Name;"
  187.     
  188.     Set rs = db.OpenRecordset(pastedSQL, dbOpenSnapshot)
  189.     If rs.RecordCount > 0 Then
  190.         rs.MoveFirst
  191.         DisplayRecord
  192.     End If
  193. End Sub
  194.  
  195. Sub DisplayRecord()
  196.     txtPublisher = rs![Name]
  197.     txtTitle = rs![Title]
  198.     txtAuthor = rs![Author]
  199.     txtPublished = rs![Year Published]
  200. End Sub
  201.  
  202.  
  203.